package cn.iocoder.yudao.module.spot.dal.mysql;

import cn.iocoder.yudao.module.spot.entity.PackEntity;
import cn.iocoder.yudao.module.spot.entity.SpotEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SpotMapper {

    @Select({"<script>"
            +"select * from cms_check"
            +" where 1=1  "
            +"<if test= 'spotEntity.approveFlag!=null and spotEntity.approveFlag!=\"\"'> and approve_flag=#{spotEntity.approveFlag} </if>"
            +"limit #{pageSize} offset #{pageNum}"
            +"</script>"})
    public List<SpotEntity> getSpotList(@Param("pageSize")int pageSize, @Param("pageNum") int pageNum,@Param("spotEntity")SpotEntity spotEntity);

    @Select({"<script>"
            +"select count(1) from cms_check"
            +" where 1=1  "
            +"<if test= 'spotEntity.approveFlag!=null and spotEntity.approveFlag!=\"\"'> and approve_flag=#{spotEntity.approveFlag} </if>"
            +"</script>"})
    public int countByParams(@Param("spotEntity")SpotEntity spotEntity);

    @Select({"<script>"
            +"select id,smc,dsmc,tbbh,zxjd,zxwd,bigclass_id,smallclass_id,bhdlx,bhdjb,kswz,ksztbh,licence,Kzlx,Kcfs,tbtymj,tbhdmj,sdzlmj,gbnd,hfyd,zlqk,tbsx,owner,syq,stid,xffs,xfsj,fkywr,jcdw,hcr,updatetime,bz,approve_flag from cms_check"
            +" where 1=1 "
            +"<if test= 'packEntity.smc!=null and packEntity.smc!=\"\"'> and smc=#{packEntity.smc} </if>"
            +"<if test= 'packEntity.dsmc!=null and packEntity.dsmc!=\"\"'> and dsmc=#{packEntity.dsmc} </if>"
            +"<if test= 'packEntity.qxmc!=null and packEntity.qxmc!=\"\"'> and qxmc=#{packEntity.qxmc} </if>"
            +"<if test= 'packEntity.tbbh!=null and packEntity.tbbh!=\"\"'> and tbbh=#{packEntity.tbbh} </if>"
            +"<if test= 'packEntity.bigclassId!=null and packEntity.bigclassId!=\"\"'> and bigclass_id=#{packEntity.bigclassId} </if>"
            +"<if test= 'packEntity.smallclassId!=null and packEntity.smallclassId!=\"\"'> and smallclass_id=#{packEntity.smallclassId} </if>"
            +"<if test= 'packEntity.zlqk!=null and packEntity.zlqk!=\"\"'> and zlqk=#{packEntity.zlqk} </if>"
            +"<if test= 'packEntity.tbsx!=null and packEntity.tbsx!=\"\"'> and tbsx=#{packEntity.tbsx} </if>"
            +"<if test= 'packEntity.approveFlag!=null and packEntity.approveFlag!=\"\"'> and approve_flag=#{packEntity.approveFlag} </if>"
            +"</script>"})
    public List<PackEntity> getPackList(@Param("packEntity") PackEntity packEntity);
}
